# -*- coding:utf8 -*-

from requests import session 
from bs4 import BeautifulSoup

def loginvalidate(username,passwd):
    loginUrl = 'http://www.morimatsu.cn:9006'
    s = session()
    r = s.get(loginUrl)

    bs = BeautifulSoup(r.text,"html.parser")
   

    __VIEWSTATE = bs.select('#__VIEWSTATE')[0].get('value')
    __EVENTVALIDATION = bs.select('#__EVENTVALIDATION')[0].get('value')
    __VIEWSTATEGENERATOR = bs.select('#__VIEWSTATEGENERATOR')[0].get('value')
    loginData = {
        '__EVENTTARGET': '',
        '__EVENTARGUMENT': '',
        '__LASTFOCUS': '',
        '__VIEWSTATE':__VIEWSTATE,
        '__VIEWSTATEGENERATOR':__VIEWSTATEGENERATOR,
        '__EVENTVALIDATION':__EVENTVALIDATION,
        'txtUsername':username,
        'txtPass':passwd,
        'btnLogin':'登 录',
        'rbl_language':'cn',
        }
    r = s.post(loginUrl, loginData)

    return not(u'登录失败' in r.text)

if __name__ == '__main__':

    userpwd = raw_input()
    print validate('0835',userpwd)
